import { Dropdown } from 'antd';
import { useEffect, useState } from 'react';
import { SketchPicker } from 'react-color'

export default function ColorPick() {
    const [color, setColor] = useState('');

    useEffect(() => {
        document.body.style.setProperty('--bg-body', color);
        document.body.style.setProperty('--main-text-color', color);
    }, [color]);

    return <Dropdown overlay={<SketchPicker 
        color={color} 
        onChangeComplete={(color)=>{
            setColor(color.hex)
        }}
    />}>
        < span > 当前主题</ span>
    </Dropdown>
    }